#include <func.h>

void* pthread_func(void* p)
{
     printf("i am child thread %ld\n",(long)p);
     return NULL;
}

int main()
{
    pthread_t pthid[2];
    int ret;
    long i;
    for(i=0;i<2;i++)
    {
        ret=pthread_create(pthid+i,NULL,pthread_func,(void*)i);
        THREAD_ERROR_CHECK(ret,"pthread_create")
    }
    // for(i=0;i<2;i++)
    // {
    //     ret=pthread_join(pthid[i],NULL);
    //     THREAD_ERROR_CHECK(ret,"pthread_join")
    // }
    pthread_join(pthid[0],NULL);
    pthread_join(pthid[1],NULL);
    printf("i am main thread\n");
    return 0;
}